home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes ƒ / Circle bulge.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.6 KB  |  59 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define    startgap            1
  4. #define    gapratio            6
  5. #define    zeropointH            15
  6. #define CorrectTime 3
  7. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  8. #define theWindowWidth (boundsRect.right-boundsRect.left)
  9.  
  10. pascal short CircleBulge(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  11.  
  12. /* This copies ovals that always run from the left of the screen to the right,
  13.    but start really squashed and get geometrically taller.  */
  14.    
  15. pascal short CircleBulge(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  16. {
  17.     Rect        theRect;
  18.     RgnHandle    curregion;
  19.     Point        zeropoint;
  20.     short            cy=theWindowHeight/2;
  21.     short            gap=startgap;
  22.     
  23.     theRect.left=boundsRect.left;
  24.     theRect.right=boundsRect.right;
  25.     theRect.top=boundsRect.top+cy-gap;
  26.     theRect.bottom=boundsRect.top+cy+gap;
  27.         
  28.     curregion=NewRgn();
  29.     zeropoint.v=boundsRect.top;
  30.     zeropoint.h=boundsRect.left+zeropointH;
  31.     do
  32.     {
  33.         StartTiming();
  34.  
  35.         SetEmptyRgn(curregion);
  36.         OpenRgn();
  37.             FrameOval(&theRect);  /* this makes the region for copying */
  38.         CloseRgn(curregion);
  39.  
  40.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  41.                 &boundsRect, &boundsRect, 0, curregion);
  42.  
  43.         theRect.top-=gap;
  44.         theRect.bottom+=gap;     /* make the oval taller */
  45.         gap++;
  46.         gap+=gap/gapratio;       /* make the oval grow faster next time */
  47.         
  48.         TimeCorrection(CorrectTime);
  49.     }
  50.     while (!(PtInRgn(zeropoint, curregion)));    /* quit when we hit zeropoint */
  51.  
  52.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  53.             &boundsRect, &boundsRect, 0, 0L);    /* copy the whole screen to end it */
  54.     
  55.     DisposeRgn(curregion);
  56.     
  57.     return 0;
  58. }
  59.